package xyz.o0o0o.demo.RetrofitDemo;

import java.io.IOException;
import java.util.List;

import retrofit2.Call;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.jackson.JacksonConverterFactory;
import xyz.o0o0o.demo.RetrofitDemo.entity.User;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args ) throws IOException
    {
        System.out.println( "Hello World!" );
        Retrofit retrofit = new Retrofit.Builder()
        	    .baseUrl("http://localhost:9090/plugins/restapi/v1/")
        	    .addConverterFactory(JacksonConverterFactory.create())
        	    .build();

        UserService service = retrofit.create(UserService.class);
        Call<List<User>> call = service.listUsers();
        Response<List<User>> execute = call.execute();
        List<User> users = execute.body();
        for (User user : users) {
			System.out.println();
		}
    }
}
